package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118641557";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String merchant_private_key ="MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCO2rxI2VLNWXMt8SIsP8ExSd27njQAZr3oQlmk8k/x9KUuQ2vVmGht+5/C97o6Rvc+z+bbL9YUdW7S/Sy1p8/IMEryPb972OxriEyz50bPx7Y3x9/ZXPr6cMH2DkG5NOJiqZpIJH5a2kPKYiajNvYlN6setLi3h99uwRQss50tomkEqYSb06oZhjIPuMVIsc3aYHoJ6szNS1abnHPFNiuNRyqB/k2YJgUfdo/ERLvScqHsCB15YUvldbfrVD7Nj6yuEXmDGrekdifdUF9cSsr6cLWs3Xa7RZSSOpHVCJnRIpTL4tG202sATKIniva2zdX9UeEqjFXlCx6q0BmjUKmnAgMBAAECggEAeX/YvCz6m+UEbYK1ieT/r6gfir9Xgy/fPXeRPxVIoYVuKBb31Ec4KrLkgrKoFYDeMPIqayoYbnYiuBjUufvsYVuRos6Z2f/5tMvMUQbX10kI1hCNdxX58J+OmHQvuhIcqcWOjuVbAnK5TZyFODQ6zhS22frjUFWj11MokYyClphRZATKnfMf75mFVvXq8ytETTu5+V30KS5v3eCApCO+6LgxAK0mKaNpAerOkFeya6wMrcZ+PMh63OYtepljjHTIF3vUa6REofyh0pyimvfct/3cz0aBPhLs/KQYTtrGvBwV1vci0qZ0grXiuXYi9o/Nlnm0/7ev79fVW241qyyuwQKBgQDO3Bbm9+gwLnSONnzds4rBgxs5Fi7gcEO+MXOvLzlNq48qjNzAqXGAbrBpHYF71EwucoOJII5OvgfZSrjkfvs0Tisl0tw6PqILSXAvmEa86LD+g0hWcsZWWTDDaNOCrJeMrLBBtph35Ff3mj+DIKirJynFwDPSKwJA2IGto16UWQKBgQCwyj714c3C/FAGDsn1d1OCK5WJ5fl6PyV/oXkAO81+BQgubqU4iqZAEZcQWljn6BytE+lhkqTE4JX2bsDNJ24JGaY7HEfk//lQVQ3QiD5dsKC8/8qoJwrsEdRhC+kn3ZAcjgZ7dDNZEB0hhoxyOU3EPgxHBYp3h88xwxQpkFlt/wKBgDkvJHGjFJ/FJ9lsfKY5DOGj4bGtTTYkMsXwG7/Q+TFcfM5RdHEaJlNPxhq42mOl841fgLc2tcBUzgymmGgqJj12Yn0pRlIfoGIoYgf2O4/bb5pcJnIndmbGbzGF1/qmxZpQ3sS7unhiOmMrU+Vm8NmnkOem02yFETFl6Ktcnze5AoGATEgX/pRd6kJgbRy4e9fvCn2v2n6GtP7GOVn9EeK7+iJFs3M+izUYIxDz87RoJDh9Fxk+XEGgIusdCeYj/uGCkx6kIWFEjET+2HC6sz32Wwq5cJOWaBPgnJfc4br38aGiaw/FMEOlXEqdpzedJjQfoAt91K9JXeYVus0HyB9m1xUCgYBtjI+o6lIUS1876U+4gyon165JkHk2YmFUnb5s4SZ48WW3zfpprYC91yUTHEkHl/eM9BKb2LwQ+MblQOsGOIFP4XCOc59YZRdYU1sApgK66Izh+/PBo1bF2qQ0PXLm5l2c8HxOgTONBPk+9j8tm5o43HbKIQpnnDuJyZOB23+OGw==";
    
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	  public static String alipay_public_key ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8/jrvOWmrIfbPl8+Uejur3SgXgPymjRAfMV/UlhEWRhd4HMxtwZ/IGFBAJqcTAoBugAlS/0IzPN+UmlwV1j3e0BAqrFTeXTGe0iVlyKCOOZddJLYAeokEFG40E7EtWnfymw30JmgFQHQ/bk5mzNt4inVAAcVw+piG/6WPXrVsDS0qlPaJX/D6n4TUNxry/oChVvaRgJbwmqnuhLg6pmvCGwFC2CQfwgXEf81LBkUd1MNO9JvJ0trFMSkGeMkFhQJUdbQro9Z/fI31xvRxVdLQliWv2sgotzgxFgj5yNm2PMnSm0jsQDRN6wp/cS2NEy6I7EljPm9M2YWFYRnSuliMwIDAQAB";
	  
	  // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/jsp/payStatus.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

